<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D导航栏</title>
    <style>
        body {
            /* perspective: 500px; */
        }
        .box {
            float: left;
            position: relative;
            width: 200px;
            height: 50px;
            margin-right: 5px;
            transform-style: preserve-3d;
            transition: all .5s;
        }
        .box:hover {
            transform: rotateX(90deg)
        }
        .box1,
        .box2 {
            position: absolute;
            width: 100%;
            height: 100%;
            line-height: 50px;
            text-align: center;
        }
        .box1 {
            background-color: cadetblue;
            /* 移动这里, 应该在盒子的中心点旋转 */
            transform: translateZ(25px);
        }
        .box2 {
            background-color: chocolate;
            transform: translateY(25px)  rotateX(-90deg) ;
            /* transform: rotateX(-90deg); */
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1">小熊</div>
        <div class="box2">小兔子</div>
    </div>
    <div class="box">
        <div class="box1">小熊</div>
        <div class="box2">小兔子</div>
    </div>
    <div class="box">
        <div class="box1">小熊</div>
        <div class="box2">小兔子</div>
    </div>
    <div class="box">
        <div class="box1">小熊</div>
        <div class="box2">小兔子</div>
    </div>
    <div class="box">
        <div class="box1">小熊</div>
        <div class="box2">小兔子</div>
    </div>
</body>
</html>